package com.rz.mvc.controller;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.rz.mvc.service.IDemoService;
import com.rz.mvcframework.annotation.RZAutowired;
import com.rz.mvcframework.annotation.RZController;
import com.rz.mvcframework.annotation.RZRequestMapping;
import com.rz.mvcframework.annotation.RZRequestParam;

/**
 * 控制层
 * @author 18217
 */

@RZController
@RZRequestMapping("/rz/")
public class DemoController {
	
	@RZAutowired
	private IDemoService demoService;
	
	@RZRequestMapping("/query")
	public void query(@RZRequestParam String name,HttpServletRequest request,HttpServletResponse response) {
		
		String result = demoService.get(name);
		try {
			response.getWriter().write(result);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	@RZRequestMapping("/add")
	public void query(@RZRequestParam Integer a, @RZRequestParam Integer b,HttpServletRequest request,HttpServletResponse response) {
		
		try {
			response.getWriter().write(a + "+" + b + "=" + (a + b));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	@RZRequestMapping("/remove")
	public void query(@RZRequestParam Integer id,HttpServletRequest request,HttpServletResponse response) {
		
	}
	
	

}
